Director Article

3D User Interfaces and 3D App Building Using the Chrome Library Set of Behaviors


Table of Contents

  1. Introduction
  2. Setting Up the Texture Render Format
  3. Setting Up Hardware Anti-Aliasing (FSAA)
  4. Setting Up the Shader Blend Level for Reflection
  5. Opening and Closing the Movable Parts of the Car
  6. Creating a UI on Top of the 3D Scene
  7. Changing the Camera
  8. Creating a 3D Navigation System for a Website
  9. Controlling Flash from Shockwave 3D
  10. Afterword and Conclusion

Changing the Camera

The graphic artist created and positioned a number of cameras in 3DS Max. You want the user to be able to switch from one view to the previous or next one with a camera travelling. For this purpose, you will use the Change Camera behavior in order to switch views, and you will use the Overlay Button UI to create the two necessary buttons to trigger the travelling.

The Change Camera behavior

Figure 18. The Change Camera behavior

The Overlay Button UI behavior

Figure 19. The Overlay Button UI behavior

  1. In the internal cast, import two 32-bit bitmap cast members with alpha channel depicting arrows, one pointing left, the other pointing right: btn_previous_camera and btn_next_camera. They are transparent so you can see the shape of them and see through. Both of these files are included in the sample files linked from the beginning of this article.
  2. Drag and drop the Change Camera behavior from the Chrome Library onto the W3D sprite, either on the Stage or in the Score. The following dialog box appears:
  3. The Change Camera parameters dialog box

    Figure 20. The Change Camera parameters dialog box

  4. Make sure the Cut parameter is unchecked and press OK.
  5. Drag and drop the Overlay Button UI behavior from the Chrome Library onto the W3D sprite, either on the Stage or in the Score. The following dialog box appears:

    The Overlay Button parameters dialog box

    Figure 21. The Overlay Button parameters dialog box

  6. Enter the relevant X and Y coordinates in pixels for the button position on top of the 3D scene. You want to have the two buttons displayed at the bottom right corner of the scene.
  7. As you do not have several different bitmaps for the normal, pressed, rollover and selected states, select the same btn_previous_camera bitmap cast member for all four states. This is mandatory.
  8. Uncheck Button Group, as you do not want a radio button behavior and you are not creating a navigation interface, only click buttons.
  9. Select the W3D Sprite number (that is, the number of the sprite channel displaying the W3D cast member).
  10. Enter the Behavior number of the previously created behavior (such as the Change Camera behavior). You need this to tell Director what behavior this button will control. You can find a behavior number by looking at the behavior list in the Behavior tab of the Property inspector.
  11. Enter previousCamera() as the Handler call.
  12. Click OK.
  13. Drag and drop the Overlay Button UI behavior from the Chrome Lib onto the W3D sprite, either on the Stage or in the Score. The following dialog box appears:

    The Overlay Button parameters dialog box

    Figure 22. The Overlay Button parameters dialog box

  14. Enter the relevant X and Y coordinates in pixels for the button position on top of the 3D scene. You want to have the two buttons displayed at the bottom right corner of the scene.
  15. As you do not have several different bitmaps for the normal, pressed, rollover, and selected states, select the same btn_next_camera bitmap cast member for all four states. This is mandatory.
  16. Uncheck Button Group as you do not want a radio button behavior and you are not creating a navigation interface but just click buttons
  17. .
  18. Select the W3D Sprite number ( that is, the number of the sprite channel displaying the W3D cast member).
  19. Enter the Behavior number of the previously created behavior (such as the Change Camera behavior). You need this to tell Director what behavior this button will control. You can know a behavior number by looking at the behavior list in the behavior tab of the Property inspector.
  20. Enter nextCamera() as the Handler call.
  21. Press OK.

Click the Play button in the Control panel or press Enter to start the movie. The previous and next camera buttons appear at the bottom right corner on top of the 3D scene. Click the next camera button (the right arrow). The camera travels smoothly to the next view (camera) present in the scene. Click the previous button (the left arrow). The camera travels smoothly to the previous view (camera) present in the scene. You can interrupt a travelling at anytime by clicking any of the two buttons to start travelling to another camera.

The camera travelling to another view

Figure 23. The camera travelling to another view

Here is the internal cast upon completion of the project:

The internal cast

Figure 24. The internal cast

(+) View larger